//
//  CGRemindDetailViewController.m
//  SchoolClient
//
//  Created by mac on 15/12/1.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "CGRemindDetailViewController.h"
#import "CGCompanyDetailOnceViewController.h"
#import "CGSchoolDetailOnceViewController.h"

@interface CGRemindDetailViewController ()

@end

@implementation CGRemindDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"提醒详情";
    self.view.backgroundColor = [Tools getColor:@"ebebeb"];

    [self layoutUI];
}

-(void)layoutUI{
//底部View
    UIView *containView = [[UIView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, SCREEN_HEIGHT - 64 - 20)];
    containView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:containView];
    
   //标题Label
    CGFloat width = containView.frame.size.width - 20;
    CGRect aFrame = CGRectMake(10, 10, width, 20);
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:aFrame];
    titleLabel.text = self.notice.title;
    [containView addSubview:titleLabel];
    
    
    //日期Label
    aFrame.origin.y = CGRectGetMaxY(titleLabel.frame) + 10;
    UILabel *timeLabel = [[UILabel alloc]initWithFrame:aFrame];
    timeLabel.text = self.notice.time;
    timeLabel.textColor = [UIColor darkGrayColor];
    timeLabel.font = [UIFont systemFontOfSize:14];
    [containView addSubview:timeLabel];
    
    
    //内容WebView
    aFrame.origin.y = CGRectGetMaxY(timeLabel.frame) + 10;
    aFrame.origin.x = 0;
    aFrame.size.width = width + 20;
    aFrame.size.height = containView.frame.size.height - 100;
    UIWebView *webView = [[UIWebView alloc]initWithFrame:aFrame];
    [webView loadHTMLString:self.notice.content baseURL:nil];
    [containView addSubview:webView];
    
    //分割线
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(5, 70, containView.frame.size.width - 10, 1)];
    line.backgroundColor = [Tools getColor:@"ebebeb"];
    [containView addSubview:line];
    
    //添加一个跳转到招聘详情的Button
    UIButton *jumpButton = [[UIButton alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, 60)];
    jumpButton.backgroundColor = [UIColor clearColor];
    [self.view addSubview:jumpButton];
    [jumpButton addTarget:self action:@selector(gotoDetailVC) forControlEvents:UIControlEventTouchUpInside];
}

//跳转到招聘详情页
-(void)gotoDetailVC{
    
    if (self.notice.company_id.length != 0) {
     
        CGCompanyDetailOnceViewController *companyVC = [CGCompanyDetailOnceViewController new];
        companyVC.company_id = self.notice.company_id;
        [self.navigationController pushViewController:companyVC animated:YES];
        return;
    
    }
    
    if (self.notice.school_id.length != 0) {
        
        CGSchoolDetailOnceViewController *schoolVC = [CGSchoolDetailOnceViewController new];
        schoolVC.school_id = self.notice.school_id;
        [self.navigationController pushViewController:schoolVC animated:YES];
        return;
        
    }
   
}



@end
